
<%@page import="com.wanmait.cookbook.vo.WorksComment"%>

<%@page import="com.wanmait.cookbook.vo.Userinfo"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.wanmait.cookbook.vo.WorksImages"%>
<%@page import="com.wanmait.cookbook.vo.Works"%>
<%@page import="com.wanmait.cookbook.vo.Userinfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<% String path = request.getContextPath(); %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>麻酱烧饼_笔记_南瓜美食</title>
<meta name="keywords"
	content="美食,菜谱,食谱,美食网,美食网站,美食分享网站,家常菜谱,家常菜谱大全,餐厅餐馆,美食网购,社区,笔记,生活笔记">
<meta name="description"
	content="南瓜美食为华人美食菜谱社区，提供各种美食、菜谱大全、食谱大全、精选的家常菜谱大全， 用户通过图文形式记录生活的点滴， 社区每天产生数万次的笔记曝光，内容覆盖时尚、护肤、美食、旅行、影视、读书、健身等各个生活方式领域。与千万会员一同分享的人生！">
<meta name="author" content="豆果美食 www.douguo.com">
<meta name="google-site-verification"
	content="2gKQfz4b2duFoGhkAMtl9EsHRd0nJWda-SxknzWYAGA">
<meta name="y_key" content="e4b03bf435642365">
<meta property="wb:webmaster" content="5d3113ad6af60df9">
<meta name="varify-v1" content="baidu-z6YB9Um9kaoKXmFf">
<meta name="baidu-site-verification" content="nQUdpXagjA">
<meta name="apple-itunes-app" content="app-id=434212566">
<meta name="360-site-verification"
	content="081686484c9d04a6965f1bf37fa47b9f">
<meta name="shenma-site-verification"
	content="f69f799dd5b5f0f6dc05e3ac55c9211b_1498788647">
<meta name="tencent-site-verification"
	content="9f275b9f30d0bdcb0458994a2f19e45b">
<meta name="360_ssp_verify" content="e2ac109d04ee9e411f4f5b6073150d21">
<link rel="icon"
	href="https://cp1.douguo.com/static/nweb/images/favicon.ico?v=1912"
	type="image/x-icon">
<link rel="stylesheet"
	href="<%=path %>/static/css/main.css?">
<link rel="stylesheet"
	href="https://cp1.douguo.com/static/nweb/css/note.css?v=1905">
<script type="text/javascript" async=""
	src="https://pos.baidu.com/auto_dup?psi=dbd704d43a84824ae99b75ec692a7e3c&amp;di=0&amp;dri=0&amp;dis=0&amp;dai=0&amp;ps=0x0&amp;enu=encoding&amp;exps=110011&amp;ant=0&amp;dcb=___baidu_union_callback&amp;dtm=AUTO_JSONP&amp;dvi=0.0&amp;dci=-1&amp;dpt=none&amp;tsr=0&amp;tpr=1604477564810&amp;ti=%E9%BA%BB%E9%85%B1%E7%83%A7%E9%A5%BC_%E7%AC%94%E8%AE%B0_%E8%B1%86%E6%9E%9C%E7%BE%8E%E9%A3%9F&amp;ari=2&amp;ver=1103&amp;dbv=2&amp;drs=3&amp;pcs=1903x969&amp;pss=1903x1479&amp;cfv=0&amp;cpl=3&amp;chi=1&amp;cce=true&amp;cec=UTF-8&amp;tlm=1604477564&amp;prot=2&amp;rw=969&amp;ltu=https%3A%2F%2Fwww.douguo.com%2Fdish%2F29647544&amp;ltr=https%3A%2F%2Fwww.douguo.com%2Fdish%2Fhot&amp;lcr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DixCax1ffg3mMb8coea48ab3J6vc_1uwtxz5HXGnPxDC%26wd%3D%26eqid%3Df73828be0000a8fb000000025fa26100&amp;ecd=1&amp;uc=1920x1040&amp;pis=-1x-1&amp;sr=1920x1080&amp;tcn=1604477565&amp;dc=4"></script>
<script
	src="https://www.googletagservices.com/activeview/js/current/osd.js?cb=%2Fr20100101"></script>
<script
	src="https://partner.googleadservices.com/gampad/cookie.js?domain=www.douguo.com&amp;callback=_gfp_s_&amp;client=ca-pub-6608973961595981&amp;cookie=ID%3Dda0997de2d217233-221895bf73c4004f%3AT%3D1603953454%3ART%3D1603953454%3AS%3DALNI_MZIr2j7VsTiX7YVEofY0_0khCAjew"></script>
<script
	src="https://pagead2.googlesyndication.com/pagead/js/r20201029/r20190131/show_ads_impl_fy2019.js"
	id="google_shimpl"></script>
<script type="text/javascript" async=""
	src="https://cpro.baidustatic.com/cpro/ui/pr.js" id="remoteOldScript"></script>
<script type="text/javascript" async=""
	src="https://kpshx.douguo.com/okmqmfmp.js"></script>
<script
	src="https://hm.baidu.com/hm.js?f4fa5d56f272ae0a0777feec2184a97f"></script>
<script
	src="https://cp1.douguo.com/static/nweb/js/jquery.js?st=20190421"></script>
<script data-ad-client="ca-pub-6608973961595981" async=""
	src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
	data-checked-head="true"></script>
<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?f4fa5d56f272ae0a0777feec2184a97f";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
    </script>
<link rel="preload"
	href="https://adservice.google.com/adsid/integrator.js?domain=www.douguo.com"
	as="script">
<script type="text/javascript"
	src="https://adservice.google.com/adsid/integrator.js?domain=www.douguo.com"></script>
</head>

<%!
//递归  方法  显示评论的所有的子评论
public void showComment(WorksComment comment,JspWriter out,String path)throws Exception
{
	out.println("<li class='clearfix' onclick='comments.addReply(&#39;&#39;, &#39;u87840589817494&#39;, &#39;19716159&#39;, &#39;8298117&#39;,0)'>");
	//显示parent	
	String name = "";
	if(comment.getParent()!=null)
	{
		name = comment.getParent().getUserinfo().getName();
	}
//	out.println(comment.getUserinfo().getName()+"回复"+name+"说:"+comment.getContent());
	out.println("<a class='author-img' href='"+path+"/PersonalServlet?action=init&id="+comment.getUserinfo().getId()+"' target_='blank' one-link-mark='yes'>");
    out.println("<img src="+path+"/static/image/"+comment.getUserinfo().getAvatar()+" alt=''>");
	out.println("</a>");
	out.println("<div class='author-comment'>");
	out.println("<a class='nickname' href='"+path+"/PersonalServlet?action=init&id="+comment.getUserinfo().getId()+"' target_='blank' one-link-mark='yes'>"+comment.getUserinfo().getName()+"回复"+name+"说:"+"</a>");
	out.println("<p class='commtxt'>"+comment.getContent()+"</p>");
	
	out.println("<input type='button' class='reply-bt' id='jubao1' data-id='"+comment.getId()+"' value='举报'  >");
	out.println("<p class='time'>"+comment.getInputTime()+"</p>");
	out.println("<a class='reply-btn' href='#a1'  UID="+comment.getId()+">回复</a>");
	out.println("</div>");
	out.println("</li>");
	if(comment.getParent()!=null)
	{
//		out.println("</li>");
//		out.println("<li class='clearfix' onclick='comments.addReply(&#39;&#39;, &#39;u87840589817494&#39;, &#39;19716159&#39;, &#39;8298117&#39;,0)'>");
	}
	//显示parent的children
	ArrayList<WorksComment> children = comment.getChildren();//获得parent的子评论
	out.println("<ul id='comments'>");
	for(WorksComment child:children)
	{
		this.showComment(child,out,path);
	}
	out.println("</ul>");
	out.println("</li>");
}
%>

<body>

	<% 
		Works works = (Works)request.getAttribute("showWorks");
		Userinfo userinfo = (Userinfo)request.getSession().getAttribute("userinfo");
		// 评论
		ArrayList<WorksComment> firstComments = (ArrayList<WorksComment>)request.getAttribute("firstComments");
		
		// 喜欢数量
		int likeCount = (int)request.getAttribute("likeCount");

	%>
	<div id="BAIDU_DUP_fp_wrapper"
		style="position: absolute; left: -1px; bottom: -1px; z-index: 0; width: 0px; height: 0px; overflow: hidden; visibility: hidden; display: none;">
		<iframe id="BAIDU_DUP_fp_iframe"
			src="https://pos.baidu.com/wh/o.htm?ltr="
			style="width: 0px; height: 0px; visibility: hidden; display: none;"></iframe>
	</div>
	<jsp:include page="/inc/head.jsp"></jsp:include>
	<script>
    //var time=Date.parse(new Date());
    $.ajax({
        url: "/login/user?time="+new Date().getTime(),
        data:"",
        success:function(res) {
            var headhtml="";
            if(res.data.user.user_id){//登录
                var user=res.data.user;
                // 发布弹窗
                headhtml+='<div class="pubt" onmouseover="javascript:$(\'.pubt-box\').show();" onmouseout="javascript:$(\'.pubt-box\').hide();"> <a class="btn-pubt" href="javascript:void(0);">发布</a> <div class="pubt-box br8"> <span class="arwwj"> </span> <a href="/upfood.html">发布菜谱</a> <a href="/caidan/create">创建菜单</a>';
                if(user.is_create_article){
                    headhtml+='<a href="/uparticle.html">发布长笔记</a>';
                }
                if(user.is_create_video){
                    headhtml+='<a href="/video/upvideo">发布视频</a>';
                }
                headhtml+="  </div> </div>";
                //头像
                headhtml+='<div class="myinfo relative" onmouseover="javascript:$(\'.myedit\').show();" onmouseout="javascript:$(\'.myedit\').hide();"> <a class="headicon" href="/u/'+user.username+'.html"> <img class="wb100 br50" src="'+user.headicon+'" alt=""> <span class="msgnum"></span> </a> <div class="myedit br8"> <span class="arwwj"> </span> <a class="relative" href="/message/remind/1" target="_blank">消息提醒 <span class="boll"></span> </a> <a href="/u/'+user.username+'/collect">我的收藏</a> <a href="/draft/recipe">草稿箱</a> <a href="/user/profile" target="_blank">账号设置</a> <a href="/logout?v=1540878216">退出</a> </div> </div>';
            }else{//未登录
                headhtml+='<div class="pubt" onmouseover="javascript:$(\'.pubt-box\').show();" onmouseout="javascript:$(\'.pubt-box\').hide();"> <a class="btn-pubt" href="javascript:void(0);">发布</a> <div class="pubt-box br8"> <span class="arwwj"> </span> <a href="/upfood.html">发布菜谱</a> <a href="/caidan/create">创建菜单</a> </div> </div> <div class="perinfo"> <a class="login" href="/login"> 登录 </a> | <a class="register" href="/signup.html" target="_blank"> 注册 </a></div>';
            }
            $("#header .header").append(headhtml);
        }
    });
</script>
	<style type="text/css">
.note-info img {
	max-width: 100%;
}
</style>
	<div class="wrapper">
		<div id="content" class="clearfix" style="position: relative;">
			<div id="left" class="mt30">
			
				<div class="note-img">
					<!--轮播图-->
					<div class="note-bimg">
					
						<ul class="bimg-list" style="left: -690px;">
							<li
								style="background-image: url('<%=path %>/static/image/<%=works.getPic() %>')">
								<img
								src="<%=path %>/static/image/<%=works.getPic() %>"
								alt="" style="width: 100%; height: 100%;">
							</li>
							<li
								style="background-image: url('<%=path %>/static/image/<%=works.getPic() %>')">
								<img
								src="<%=path %>/static/image/<%=works.getPic() %>"
								alt="" style="width: 100%; height: 100%;">
							</li>
						</ul>
					</div>
				</div>
				
				<!--作者-->
				<div class="menu-head">
					<h3 class="note-title relative" style="font-weight: normal">
						<span style="max-width: 590px; font-weight: bold;"><%=works.getTitle() %>&nbsp
						</span>
						<div  class="author clearfix">
					<%if(userinfo!=null) {
						Boolean flag = (Boolean)request.getAttribute("flag");
						
						if(flag){
							%>
							<input type="button" disabled style="background-color: darkorange;border:1px solid black" class="ww" value="已举报" id="jubao"  data-act="add"></a>
							<%
						}else{
							%>
								<input type="button" style="background-color: darkorange;border:1px solid black" class="ww" value="举报" id="jubao"  data-act="add"></a>
							<%
						}
					}else{
						%>
						<input type="button" style="background-color: darkorange;border:1px solid black" class="ww" value="举报" id="jubao"  data-act="add"></a>
						<%
					}
					%>	
					</div>
						<div class="editmod" style="bottom: 4px;"></div>
					</h3>
					<div class="author clearfix">
						<div class="author-img">
							<a href="<%=path %>/PersonalServlet?action=init&id=<%=works.getUserinfo().getId() %>"> <img
								src="<%=path %>/static/image/<%=works.getUserinfo().getAvatar() %>"
								alt="">
							</a>
						</div>
						<div class="author-info">
							<h3 style="width: auto; max-width: 372px; margin-right: 20px;">
								<a href="<%=path %>/PersonalServlet?action=init&id=<%=works.getUserinfo().getId() %>"><%=works.getUserinfo().getName() %></a>
							</h3>
							<a class="gz" href="javascript:;" data-action="add"
								><span class="addicon">＋</span> 关注</a>
						</div>
						<div class="fav-share clearfix">
							<span class="not-like" data-like="not-like" 
								style="border: 1px solid #FFB31A; color: #FFB31A;"><span class="zan">＋</span><span class="likeCount"><%=likeCount %></span></span> 
								<a href="javascript:;" class="btn-collect" data-favorite="unFavorite">收藏</a>

						</div>
						<div class="fav-share clearfix">
							
						</div>
					</div>
					<!-- 举报 -->	
					
				</div>
				
				<!--笔记内容-->
				<div class="note-content relative">
					<div class="note-info"><%=works.getInfo() %></div>

					<div class="other-info"><%=works.getInputTime() %></div>
					
				</div>
				<!--评论-->
				
				<div id="comment" class="comment">
				<a name="a1">
					<div id="comment-text">
						<h2 class="mini-title">评论</h2>
						<div class="in-comment clearfix">

							<%
								if (session.getAttribute("userinfo") == null) {
							%>
							<div class="author-img">
								<img class="br50" width="30" height="30"
									src="<%=path%>/static/image/nangua.jpg" alt="南瓜美食">
							</div>
							<p class="comm-txt left">
								发表评论，你需要 <a href="<%=path%>/login.jsp">登录</a> 或 <a
									href="<%=path%>/registe.jsp" target="_blank">注册</a>
							</p>
							<a href="javascript:;" class="comm-btn no-btn"
								one-link-mark="yes">发表评论</a>
							<%
								} else {
							%>
							<div class="author-img">
								<img class="br50" width="30" height="30"
									src="<%=path%>/static/image/<%=userinfo.getAvatar()%>"
									alt="<%=userinfo.getName()%>">
							</div>
							<textarea class="comm-txt left" id="commentContent"></textarea>
							<a href="javascript:;" class="comm-btn no-btn"
								one-link-mark="yes">发表评论</a>
							<%
								}
							%>
						</div>
					</div>
				</a>
				<ul id="comments">
					<%
					for(WorksComment comment:firstComments)//循环的一级评论
					{
						this.showComment(comment,out,path);
					}
				%>
				</ul>
			</div>
				<br><br>
			
				
			</div>

		</div>
		<div class="motai">
			<div class="bg"></div>
			<div class="neirong">
				<h1>请扫码进入南瓜美食App查看</h1>
				<img
					src="https://cp1.douguo.com//static/nweb/images/qrcode.png?1912"
					alt=""> <span onclick="$('.motai').hide()"></span>
			</div>
		</div>
		
	</div>
	<ins class="adsbygoogle adsbygoogle-noablate"
		data-adsbygoogle-status="done" style="display: none !important;">
		<ins id="aswift_0_expand"
			style="display: inline-table; border: none; height: 0px; margin: 0; padding: 0; position: relative; visibility: visible; width: 0px; background-color: transparent;">
			<ins id="aswift_0_anchor"
				style="display: block; border: none; height: 0px; margin: 0; padding: 0; position: relative; visibility: visible; width: 0px; background-color: transparent;">
				<iframe id="aswift_0" name="aswift_0"
					style="left: 0; position: absolute; top: 0; border: 0; width: undefinedpx; height: undefinedpx;"
					sandbox="allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation"
					frameborder="0"
					src="https://googleads.g.doubleclick.net/pagead/ads?guci=2.2.0.0.2.2.0.0&amp;client=ca-pub-6608973961595981&amp;output=html&amp;adk=1812271804&amp;adf=3025194257&amp;lmt=1604477564&amp;plat=1%3A32776%2C2%3A16809992%2C9%3A32776%2C10%3A32%2C11%3A32%2C16%3A8388608%2C17%3A32%2C24%3A32%2C25%3A32%2C30%3A1081344%2C32%3A32%2C40%3A32&amp;format=0x0&amp;url=https%3A%2F%2Fwww.douguo.com%2Fdish%2F29647544&amp;ea=0&amp;flash=0&amp;pra=5&amp;wgl=1&amp;tt_state=W3siaXNzdWVyT3JpZ2luIjoiaHR0cHM6Ly9hZHNlcnZpY2UuZ29vZ2xlLmNvbSIsInN0YXRlIjowfSx7Imlzc3Vlck9yaWdpbiI6Imh0dHBzOi8vYXR0ZXN0YXRpb24uYW5kcm9pZC5jb20iLCJzdGF0ZSI6MH1d&amp;dt=1604477564768&amp;bpp=7&amp;bdt=55&amp;idt=68&amp;shv=r20201029&amp;cbv=r20190131&amp;ptt=9&amp;saldr=aa&amp;abxe=1&amp;cookie=ID%3Dda0997de2d217233-221895bf73c4004f%3AT%3D1603953454%3ART%3D1603953454%3AS%3DALNI_MZIr2j7VsTiX7YVEofY0_0khCAjew&amp;nras=1&amp;correlator=6687479198971&amp;frm=20&amp;pv=2&amp;ga_vid=55106075.1603953456&amp;ga_sid=1604477565&amp;ga_hid=301484967&amp;ga_fc=1&amp;iag=0&amp;icsg=135430144&amp;dssz=19&amp;mdo=0&amp;mso=8&amp;u_tz=480&amp;u_his=1&amp;u_java=0&amp;u_h=1080&amp;u_w=1920&amp;u_ah=1040&amp;u_aw=1920&amp;u_cd=24&amp;u_nplug=3&amp;u_nmime=4&amp;adx=-12245933&amp;ady=-12245933&amp;biw=1903&amp;bih=969&amp;scr_x=0&amp;scr_y=0&amp;eid=21067466&amp;oid=3&amp;pvsid=2055445231597694&amp;pem=360&amp;ref=https%3A%2F%2Fwww.douguo.com%2Fdish%2Fhot&amp;rx=0&amp;eae=2&amp;fc=1920&amp;brdim=0%2C0%2C0%2C0%2C1920%2C0%2C1920%2C1040%2C1920%2C969&amp;vis=1&amp;rsz=%7C%7Cs%7C&amp;abl=NS&amp;fu=8200&amp;bc=31&amp;ifi=0&amp;uci=a!0&amp;fsb=1&amp;dtd=84"
					marginwidth="0" marginheight="0" vspace="0" hspace="0"
					allowtransparency="true" scrolling="no" allowfullscreen="true"
					data-google-container-id="a!0" data-load-complete="true"></iframe>
			</ins>
		</ins>
	</ins>
	<script>
    $(function(){
       	if(<%=session.getAttribute("userinfo")!=null%>){
        	$.ajax({
        		url:"<%=path%>/WorksCollectServlet",
        		data:{action:"judgeCollection",worksId:"<%=works.getId()%>"},
        		success:function(msg){
        			if(msg=="true"){
        				$(".btn-collect").html("已收藏");
        			}
        			else{
        				$(".btn-collect").html("收藏");
        			}
        		}
        	});
        	$(".btn-collect").click(function(){
        		var ht = $(this).html();
        		if(ht=="已收藏"){
        			if(!window.confirm("确认取消收藏？")){
        				return;
        			}
        			$.ajax({
        	    		url:"<%=path%>/WorksCollectServlet",
        	    		data:{action:"cancelCollection",worksId:"<%=works.getId()%>"}
        	    	});
        			$(".btn-collect").html("收藏");
        		}
        		else{
        			$.ajax({
        	    		url:"<%=path%>/WorksCollectServlet",
        	    		data:{action:"addCollection",worksId:"<%=works.getId()%>"}
        	    	});
        			$(".btn-collect").html("已收藏");
        		}
        	});
        	$.ajax({
        		url:"<%=path%>/AttentionServlet",
        		data:{action:"judgeAttention",authorId:"<%=works.getUserinfo().getId()%>"},
        		success:function(msg){
        			if(msg=="true"){
        				$(".addicon").text("已");
        			}
        			else{
        				$(".addicon").text("+");
        			}
        		}
        	});
        	$(".gz").click(function(){
        		if($(".addicon").text()=="+"){
        			$.ajax({
        				url:"<%=path%>/AttentionServlet",
        				data:{action:"addAttention",authorId:"<%=works.getUserinfo().getId()%>"}
        			});
        			$(".addicon").text("已");
        		}
        		else{
        			if(!window.confirm("确定取消关注？")){
        				return;
        			}
        			$.ajax({
        				url:"<%=path%>/AttentionServlet",
        				data:{action:"cancelAttention",authorId:"<%=works.getUserinfo().getId()%>"}
        			});
        			$(".addicon").text("+");
        		}
        	});
      
        	var UID = 0;
        	$(".reply-btn").click(function(){
        		UID = $(this).attr("UID");
        	});
        	$(".comm-btn").click(function(){
        		if($("#commentContent").val()==""){
        			alert("请正确输入。")
        		}
       			else{
        			var content = $("#commentContent").val();
        			$.ajax({
        				url:"<%=path%>/CommentServlet",
        				async:false,
        				data:{action:"worksPostComment",content:content,worksId:"<%=works.getId()%>",UID:UID},
        				success:function(msg){
        					window.location.href="<%=path%>/HotWorksServlet?action=showWorks&worksId=<%=works.getId()%>";
        				}
        			});
        		}
        	});
        	
        	$.ajax({
        		url:"<%=path%>/LikeServlet",
        		data:{action:"judgeWorksLike",worksId:"<%=works.getId()%>"},
        		success:function(msg){
        			if(msg=="true"){
        				$(".zan").text("");
        			}
        			else{
        				$(".zan").text("+");
        			}
        		}
        	});
        	$(".not-like").click(function(){
        		if($(".zan").text()=="+"){
        			$.ajax({
        				url:"<%=path%>/LikeServlet",
        				data:{action:"addWorksLike",worksId:"<%=works.getId()%>"},
        				success:function(msg){
        					$(".likeCount").text(msg);
        				}
        			});
        			$(".zan").text("");
        		}
        		else{
        			alert("<%=works.getId()%>");
        			$.ajax({
        				url:"<%=path%>/LikeServlet",
        				data:{action:"cancelWorksLike",worksId:"<%=works.getId()%>"},
        				success:function(msg){
        					$(".likeCount").text(msg);
        				}
        			});
        			$(".zan").text("+");
        		}
        	});
        	
        }
    	else{
        	$(".btn-collect").click(function(){
        		$.ajax({
    	    		url:"<%=path%>/WorksCollectServlet",
    	    		data:{action:"addCollection",worksId:"<%=works.getId()%>"},
    	    		success:function(msg){
    	    			if("no"==msg){
    	    				window.location.href="<%=path%>/login.jsp";
    	    			}
    	    		}
    	    	});
        	});
        	$(".gz").click(function(){
        		$.ajax({
        			url:"<%=path%>/AttentionServlet",
        			data:{action:"addAttention",authorId:"<%=works.getUserinfo().getId()%>"},
        			success:function(msg){
        				if("no"==msg){
        					window.location.href="<%=path%>/login.jsp";
        				}
        			}
        		});
        	});
        	$(".not-like").click(function(){
        		$.ajax({
        			url:"<%=path%>/LikeServlet",
        			data:{action:"addWorksLike",worksId:"<%=works.getId()%>"},
        			success:function(msg){
        				if("no"==msg){
        					window.location.href="<%=path%>/login.jsp";
        				}
        			}
        		});
        	});
        }
    })

	
</script>
	<div id="footer">
		<jsp:include page="/inc/foot.jsp"></jsp:include>
	</div>
	<script src="https://cp1.douguo.com/static/nweb/js/tip.js?v=2019"></script>
	<script
		src="https://cp1.douguo.com/static/nweb/js/search.js?v=12171145"></script>
	<script src="https://cp1.douguo.com/static/nweb/js/main.js?v=201911"></script>
	<!-- <script src='https://s13.cnzz.com/c.php?id=30029854' language='JavaScript' charset='gb2312'></script> -->

<!-- 举报弹窗 -->
<style>
.modal {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定定位 */
    z-index: 1; /* 设置在顶层 */
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%;
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.4); 
}
  
/* 弹窗内容 */
.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 20%; 
}
  
/* 关闭按钮 */
.close {
    color: #fff;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
  
.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
</style>
<body>
 
  
<!-- 弹窗 -->
<div id="myModal" class="modal">
  
  <!-- 弹窗内容 -->
  <div class="modal-content">
    <span class="close">&times;</span>
    <label for="">举报理由</label>
    <select class="liyou">
    <option value="1">暴力</option>
    <option value="2">色情</option>
    <option value="3">广告</option>
    <option value="4">诈骗</option>
    <option value="5">其他</option>
    </select>
    <button class="sure">確定</button>
    <button class="cancel">取消</button>
  </div>
  
</div>
<script>
// 获取弹窗
var modal = document.getElementById('myModal');
  
// 打开弹窗的按钮对象
var btn = document.getElementById('jubao');
  
// 获取 <span> 元素，用于关闭弹窗
var span = document.querySelector('.close');
 
//获取 確定 按鈕
var sure = document.querySelector('.sure');
 
//获取 取消 按鈕
var cancel = document.querySelector('.cancel');
  
// 点击按钮打开弹窗
btn.onclick = function() {
    modal.style.display = "block";
}
  
// 点击 <span> (x), 关闭弹窗
span.onclick = function() {
    modal.style.display = "none";
}
  
// 在用户点击其他地方时，关闭弹窗
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}
 
// 在用户点击確定按鈕
/* sure.onclick = function(event) {
  modal.style.display = "none";
  var user = document.querySelector('.user').value;
  var age = document.querySelector('.age').value;
  alert("你的名字： "+user+"\n 你的年齡： "+age)
} */
$(function(){
	var ok =$(sure);
	ok.click(function(){
		var val = $(".liyou").val();
		if(<%=userinfo==null%>){
			location.href="<%=path%>/login.jsp";
		}else{
			var worksId ="<%=works.getId()%>";
			var mu=$("#jubao").val();
			if(mu=="举报"){	
				$.ajax({
					url:"<%=path%>/WorksReportServlet?action=worksReport",
					data:{worksId:worksId,val:val},
					success:function(){
						$("#jubao").val("已举报");
						modal.style.display = "none";
						$("#jubao").prop("disabled",true);
					}
				})
			}
		}
	})
});

 
 
// 在用户点击取消按鈕
cancel.onclick = function(event) {
  modal.style.display = "none";
}
 
</script>  
</body>
</html>
<!-- 弹窗结束 -->

</html>

<script>
<%-- $(function(){
	$("#jubao").click(function(){
		var val=$("#jubao").val();
		if(<%=userinfo==null%>){
			location.href="<%=path%>/login.jsp";
		}else{
			var worksId ="<%=works.getId()%>";
			if(val=="举报"){	
				$.ajax({
					url:"<%=path%>/WorksReportServlet?action=worksReport",
					data:{worksId:worksId},
					success:function(){
						$("#jubao").val("已举报");
					}
				})
			}
		}
	})
}) --%>
</script>




<!-- 举报弹窗 -->
<style>
.modal1 {
    display: none; /* 默认隐藏 */
    position: fixed; /* 固定定位 */
    z-index: 1; /* 设置在顶层 */
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%;
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.4); 
}
  
/* 弹窗内容 */
.modal-content1 {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 20%; 
}
  
/* 关闭按钮 */
.close1 {
    color: #fff;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
  
.close1:hover,
.close1:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}
</style>
<!-- 弹窗 -->
<div id="myModal1" class="modal1">
  
  <!-- 弹窗内容 -->
  <div class="modal-content1">
    <span class="close1">&times;</span>
    <label for="">举报理由</label>
    <select class="liyou1">
    <option value="1">暴力</option>
    <option value="2">色情</option>
    <option value="3">广告</option>
    <option value="4">诈骗</option>
    <option value="5">其他</option>
    </select>
    <button class="sure1">確定</button>
    <button class="cancel1">取消</button>
  </div>
  
</div>
<script>
// 获取弹窗
var modal1 = document.getElementById('myModal1');
  
// 打开弹窗的按钮对象
/* var btn1 = $(".reply-bt"); */
  
// 获取 <span> 元素，用于关闭弹窗
var span1 = document.querySelector('.close1');
 
//获取 確定 按鈕
var sure1 = document.querySelector('.sure1');
 
//获取 取消 按鈕
var cancel1 = document.querySelector('.cancel1');
  
// 点击按钮打开弹窗
/* $(btn1).onclick = function() {
    modal1.style.display = "block";
} */
var pp = $(".reply-bt");

  
// 点击 <span> (x), 关闭弹窗
span1.onclick = function() {
    modal1.style.display = "none";
}
  
// 在用户点击其他地方时，关闭弹窗
window.onclick = function(event) {
    if (event.target == modal1) {
        modal1.style.display = "none";
    }
}

$(function(){
	pp.click(function(){
		$("#myModal1").css("display","block");
		var th = $(this);
		var ok =$(sure1);
		ok.click(function(){
		var val = $(".liyou1").val();
		if(<%=userinfo==null%>){
			location.href="<%=path%>/login.jsp";
		}else{
			var commentId =th.data("id");
			var mu=th.val();
			if(mu=="举报"){	
				$.ajax({
					url:"<%=path%>/WorksReportServlet?action=worksCommentReport",
					data:{commentId:commentId,val:val},
					success:function(){
						th.val("已举报");
						modal1.style.display = "none";
						th.prop("disabled","true");
					}
				})
			}
		}
	})
});
})
 
 
// 在用户点击取消按鈕
cancel1.onclick = function(event) {
  modal1.style.display = "none";
}
$(function(){
	$(".reply-bt").each(function(){
		 var id=$(this).data("id");
		 var th =$(this);
		 $.ajax({
			 url:"<%=path%>/WorksReportServlet?action=isReprot",
			 data:{id:id},
			 success:function(mes){
				 if(mes=="ok"){
					 th.val("已举报");
					 th.prop("disabled","true"); 
				 }
			 }
		 })
	 })
})
</script>  
<!-- 弹窗结束 -->